package com.lifeng.patterns.strategy;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by lifeng on 2019/8/15.
 */
@RestController
public class StrategyController {
    @Resource
    private PayTypeSelect payTypeSelect;
    @Resource
    private OldPayTypeSelect oldPayTypeSelect;

    @RequestMapping("/orderPay")
    public String orderPay(String payStyle){
        PayType payType = payTypeSelect.select(payStyle);
        payType.pay(new PayOrderVo());
        return "ok";
    }

    @RequestMapping("/orderPay1")
    public String orderPay1(String payStyle){
        PayType payType = oldPayTypeSelect.select(payStyle);
        payType.pay(new PayOrderVo());
        return "ok";
    }
}
